﻿using System;
using System.Collections;
using System.Collections.Generic;

using AUV5.Model;
using AUV5.DAL.Interface;

namespace AUV5.DAL.Dao
{
	/// <summary>
	/// 功能：     FailedLogins业务接口的实现
	/// 作者：     LI
 	/// 日期：     2011/12/8
 	/// 修改日期： 
 	/// 修改人：
 	/// 修改内容：
	/// </summary>
	public class FailedLoginsSqlMapDao : BaseSqlMapDao,IFailedLoginsDao
	{
		private static FailedLoginsSqlMapDao instance =null;
		private static object syncRoot = new object();
		
		private FailedLoginsSqlMapDao ()
		{
			//
			// TODO: 此处添加FailedLoginsSqlMapDao的构造函数
			//
		}
		public static IFailedLoginsDao Instance
        {
            get 
            {
                if (instance == null)
                {
                    lock (syncRoot)
                    {
                        if (instance == null)
                        {
                            instance = new FailedLoginsSqlMapDao();
                        }
                    }
                }
                return instance;
            }
        }
		
		/// <summary>
		/// 得到最大行数
		/// </summary>
		/// <returns></returns>
		public int GetMaxCounts()
		{
			try
			{
				return (int)ExecuteQueryForObject("SelectFailedLoginsByMaxCounts",null);
			}
            catch
            {
                throw;
            }
		}

		/// <summary>
		/// 得到列表
		/// </summary>
		/// <returns></returns>
		public System.Collections.Generic.IList<FailedLogins> GetList()
		{
			try
			{
				return ExecuteQueryForList<FailedLogins>("SelectFailedLogins",null);
			}
            catch
            {
                throw;
            }
		}
		
		/// <summary>
		/// 通过不同参数得到列表
		/// </summary>
		/// <param name="objParameters"></param>
		/// <returns></returns>
		public System.Collections.Generic.IList<FailedLogins> GetListByParameters(object objParameters)
		{
			try
			{
				return ExecuteQueryForList<FailedLogins>("SelectFailedLoginsByParameters",objParameters);
			}
            catch
            {
                throw;
            }
		}
		
		/// <summary>
		/// 得到明细
		/// </summary>
		/// <param name="IpAddress"></param>
		/// <returns></returns>
		public FailedLogins GetDetail(System.String ipaddress)
		{
			try
			{
				return ExecuteQueryForObject<FailedLogins>("SelectFailedLogins",ipaddress) as FailedLogins;
			}
            catch
            {
                throw;
            }
		}
		
		/// <summary>
        /// 新建
        /// </summary>
        /// <param name="failedlogins"></param>
        /// <returns></returns>
		public object Add(FailedLogins failedlogins)
		{
			//int id = GetId("FailedLogins");
			//failedlogins.IpAddress = id;
			
			try
			{
				return ExecuteInsert("InsertFailedLogins",failedlogins);
			}
            catch
            {
                throw;
            }
		}
		
		/// <summary>
        /// 修改
        /// </summary>
        /// <param name="failedlogins"></param>
        /// <returns></returns>
		public int Update(FailedLogins failedlogins)
		{
			try
			{
				return ExecuteUpdate("UpdateFailedLogins",failedlogins);
			}
            catch
            {
                throw;
            }			
		}

		/// <summary>
		/// 删除
		/// </summary>
		/// <param name="IpAddress"></param>
		/// <returns></returns>
		public int Delete(System.String ipaddress)
		{
			try
			{
				return ExecuteDelete("DeleteFailedLogins",ipaddress);
			}
            catch
            {
                throw;
            }
		}
		/// <summary>
		/// 删除
		/// </summary>
		/// <param name="failedlogins"></param>
		/// <returns></returns>
		public int Delete(FailedLogins failedlogins)
		{
			try
			{
				return ExecuteDelete("DeleteFailedLogins",failedlogins.IpAddress);
			}
            catch
            {
                throw;
            }
		}
	}
}
